<?php

namespace frontend\controllers;

use Yii;
use common\models\IcoApply;
use common\search\IcoApplySearch;
use frontend\controllers\BaseController;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * IcoApplyController implements the CRUD actions for IcoApply model.
 */
class IcoApplyController extends BaseController
{

    /**
     * Creates a new IcoApply model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $this->returnJson = true;
        $model = new IcoApply();
        $model->load(Yii::$app->request->post(),'');
        $model->save();
        return $this->renderJson();
    }


    /**
     * Finds the IcoApply model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param string $id
     * @return IcoApply the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    protected function findModel($id)
    {
        if (($model = IcoApply::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
}
